package com.kanche.bigbaby.support.base;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;

import com.kanche.bigbaby.BBService;

/**
 * Created by Chenshao_Young on 15/5/15.
 */
public abstract class BaseActivity extends AppCompatActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        setContentView(getContentViewId());
        initViewAndListenerAndData();

    }

    @Override
    public void startActivity(Intent intent) {
        super.startActivity(intent);
//        overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_right);
//        overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
    }

    @Override
    public void finish() {
        super.finish();
//        overridePendingTransition(R.anim.slide_in_left,R.anim.slide_out_right);
        overridePendingTransition(android.R.anim.slide_in_left,android.R.anim.slide_out_right);
    }

    protected abstract int getContentViewId();
    protected abstract void initViewAndListenerAndData();

    public <T extends View> T justFindIt(int id) {
        return (T)findViewById(id);
    }

    public BBService getBBService(){
        return  BBService.Creator.create(this);
    }
}
